package com.pruebas.andEngine;

import org.anddev.andengine.engine.handler.physics.PhysicsHandler;
import org.anddev.andengine.entity.sprite.AnimatedSprite;
import org.anddev.andengine.opengl.texture.region.TiledTextureRegion;

public class VillanoRosado extends AnimatedSprite{
	private final PhysicsHandler mPhysicsHandler;
	private Float posicionActual;
	static final int DESPLAZAMIENTO = 10;
	
		public VillanoRosado(final float pX, final float pY, final TiledTextureRegion pTextureRegion){
			super(pX, pY, pTextureRegion);
			this.mPhysicsHandler = new PhysicsHandler(this);
		    this.registerUpdateHandler(this.mPhysicsHandler);
		}
	
		public void setVelocityY(float velocity){
		    mPhysicsHandler.setVelocityY(velocity);
		}
		
		public boolean moveSprite(int valor){
			posicionActual = this.getX();
            this.setPosition(posicionActual - (DESPLAZAMIENTO + valor), this.getY()); //posicionActual - 10
            
            if(this.getX() <= -this.getWidth()){
          	  this.stopAnimation();
          	  return false;
            }
            return true;
		}
}
